#!/usr/bin/env python
# coding: utf-8

# In[2]:


import numpy as np
import cv2 
import json
import os

L = []

src_dir = "./1image/"
save_dir = "./3resize/"


color = (0,0,0)  #(128,128,128)
for root,dirs,files in os.walk(src_dir):
    for file in files:
        if os.path.splitext(file)[1]=='.png':
            L.append(root+file)
        elif os.path.splitext(file)[1]=='.bmp':
            L.append(root+file)
# (2048,2560) 1996
for index in range(len(L)):
#for index in range(1):
    pic = cv2.imread(L[index],-1)
    #pic2 = cv2.resize(pic,(2560,1996),interpolation=cv2.INTER_LINEAR)
    pic2 = cv2.resize(pic,(306*2,256*2),interpolation=cv2.INTER_LINEAR)
    
    cv2.imwrite(save_dir+str(index).zfill(4)+".jpg",pic2)
#print("finish!")
#cv2.imwrite("show/"+result['imagePath'],showpic)
#cv2.imwrite("label/"+result['imagePath'],mask)
# In[6]:


#cv2.imwrite("mask/"+result['imagePath'],mask)

# In[1]:
#showpic = ((pic)*((255-mask)/255*0.25+mask/255)).astype("uint8")
#colors = [[np.random.randint(0,255)for _ in range(3)]for _ in range(10)]
#showpic = (pic+mask/255*color).astype("uint8")


#cv2.imshow("showpic",showpic)
#cv2.waitKey(0)





